package cn.lanqiao.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import cn.lanqiao.entity.Admin;
import cn.lanqiao.entity.Student;
import cn.lanqiao.entity.Teacher;


@Mapper
public interface LoginMapper {


	    @Select("select adminId,adminName,sex,tel,email,pwd,cardId,role from admin where email = #{username} and pwd = #{password}")
	    public Admin adminLogin(String username, String password);

	    @Select("select teacherId,teacherName,institute,pwd,sex,tel,email,cardId," +
	            "type,role from teacher where email = #{username} and pwd = #{password}")
	    public Teacher teacherLogin(String username, String password);

	    @Select("select studentId,studentName,grade,major,pwd,studentClass,institute,tel," +
	            "email,cardId,sex,role from student where email = #{username} and pwd = #{password}")
	    public Student studentLogin(String username,String password);

	    @Select("select count(1) from student where email = #{username}")
	    public Integer getUserByUsername(String username);
	    
	    @Select("select count(1) from teacher where email = #{username}")
	    public Integer getUserByTeachername(String username);
}
